<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@include file="../head.jsp"%>
<html>
<head>
    <title>上海新急便国际货物运输代理有限公司</title>
    <style type="text/css">
        <!--
        .td_norepeat{
            background-image:url(/fsxt/resources/images/top.gif);
            background-repeat:no-repeat;
        }
        -->
    </style>
    <script type="text/javascript">
        (function(){
            Ext.onReady(function(){
                var items = [];
                Ext.define('treeModel', {
                    extend: 'Ext.data.Model',
                    fields: [
                        {name: 'id',type: 'string'},
                        {name: 'menuName',type: 'string'},
                        {name: 'menuLink',type: 'string'},
                        {name: 'text',type: 'string'}
                    ]
                });

                <s:iterator id="cell" value="#request.tabList">
                var store_<s:property value="id"/> = Ext.create('Ext.data.TreeStore', {
                    id:'store_<s:property value="id"/>',
                    model:'treeModel',
                    nodeParam:'id',
                    autoLoad:false,
                    proxy: {
                        type:'ajax',
                        url:'/fsxt/sys/operation!getPrivateChildTree.action'
                    },
                    root: {
                        id: '<s:property value="id"/>',
                        text: '<s:property value="menuName"/>',
                        expanded: true
                    },
                    listeners:{
                        'load':function(){
                            tree_<s:property value="id"/>.expandAll();
                        }
                    }
                });

                var tree_<s:property value="id"/> = Ext.create('Ext.tree.Panel', {
                    store:store_<s:property value="id"/>,
                    margins: '0 5 0 0',
                    autoHeight:true,
                    autoScroll: true,
                    split: true,
                    rootVisible:false,
                    lines:true,
                    containerScroll: true,
                    useArrows: true,
                    listeners:{
                        'itemclick':function(view,record,item,index,evt,options){
                            if(!record.data.leaf) return;
                            if(Ext.getCmp(record.data.id)){
                                Ext.getCmp(record.data.id).show();
                            }else{
                                contentPanel.add({
                                    title:record.data.menuName,
                                    id: record.data.id,
                                    closable:true,
                                    html:'<iframe src='+record.data.menuLink+' style="width:100%;height:100%"/>'
                                }).show();
                            }
                        }
                    }
                });

                var item_<s:property value="id"/> = Ext.create('Ext.form.Panel',{
                    title:'<s:property value="menuName"/>',
                    layout:'fit',
                    containerScroll:true,
                    autoScroll:true,
                    iconCls:'edit',
                    items:[tree_<s:property value="id"/>]
                });

                items.push(item_<s:property value="id"/>);
                </s:iterator>

                var accordion = Ext.create('Ext.form.Panel',{
                    region:'west',
                    iconCls:'edit',
                    title:'系统菜单',
                    split:false,
                    collapsible: true,
                    width: 190,
                    layout:'accordion',
                    layoutConfig: {
                        titleCollapse: true,
                        animate: true
                    },
                    items: items
                });

                var contentPanel =Ext.createWidget('tabpanel', {
                    id:'center',
                    region:'center',
                    enableTabScroll:true,
                    activeTab:0,
                    items:[{
                        id:'homePage',
                        title:'首页',
                        iconCls:'edit',
                        autoScroll:true,
                        contentEl :'mainIframe'
                    }]
                });

                // 设置页面布局
                var viewport = new Ext.Viewport({
                    id:'viewport',
                    layout: 'border',
                    items: [{
                        id:'top',
                        region:'north',
                        contentEl:'topDiv',
                        split: false ,
                        height:47
                    },/*{
                     id:'bottom',
                     region: 'south',
                     autoLoad:{url:"foot.jsp" },
                     height: 28,
                     split: true,
                     collapsible: true
                     //暂留
                     },*/accordion,contentPanel
                    ]
                });
            })
        })();
        function logout(){
            if(confirm("确定注销登录么")){
                location.href = '/fsxt/logout.action';
            }
        }
        function changePassword(){
            location.href = '/fsxt/sys/changePassword.action';
        }
    </script>
</head>
<body>
<iframe id="mainIframe" name="mainIframe" frameborder="0" src="/fsxt/jsp/sys/include.jsp" style="width:100%;height:100%"></iframe>
<div id = "topDiv">
    <table width="100%" border="0" height=50 cellpadding="0" cellspacing="0" >
        <tr>
            <td class="td_norepeat" bgcolor="#023D79" align="right" >
                <table border="0" cellpadding="0" cellspacing="0" >
                    <tr>
                        <td align="right" >

                            <a href="#" style="text-decoration: none;" onclick="changePassword();"><font color='white' size="2" face="微软雅黑">密码修改</font></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <a href="#" style="text-decoration: none;" onclick="logout()"><font color='white' size="2" face="微软雅黑">退出</font></a>&nbsp;&nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td align="right" >
                            <font color='white' size="2" face="微软雅黑">当前用户：<s:property value="#request.sysOperatorName"/></font>&nbsp;&nbsp;&nbsp;&nbsp;　
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</div>
</body>
</html>
